//
//  Line.swift
//  SwiftUIShape
//
//  Created by 李煜 on 2024/7/31.
//

import SwiftUI

struct Line: View {
    var body: some View {
				
		//线条
		Path({ path in
			path.move(to: CGPoint(x: 20, y: 20))
			path.addLine(to: CGPoint(x: 200, y: 20))
			path.addLine(to: CGPoint(x: 200, y: 200))
			path.addLine(to: CGPoint(x: 20, y: 200))
			//可以使用path.closeSubPath()直接闭合(起点终点)
			//path.closeSubpath()
		})
		.stroke(Color.blue, lineWidth: 10)
	}
}

#Preview {
    Line()
}
